<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" /> 
	<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
	<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
	<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}"></script>
	
	<script> 
		function directs(name){
			var chk_value =[];    
			$('input[name="'+name+'"]:checked').each(function(){    
				chk_value.push($(this).val());   
			}); 	
			if(chk_value.length==0){ 
				parent.layer.msg("请选择要推送的简历！",2,8);return false;		
			}else{		
				parent.layer.confirm("确定推荐吗？",function(){ 
					parent.layer.closeAll();
					var length = chk_value.length;
					$.layer({
		 				type : 1,
						title : false,
						closeBtn : [0 , false],  
						border : [10 , 0.3 , '#000', true],
						area : ['150px','50px'],
						page : {html : '<font style=\'float: left;font-size: 14px; height: 50px;line-height: 50px;text-align: center;width: 150px;\'>发送进度：<span id=\'send_num\'>0</span>/<span>'+length+'</span></font>'}
					}); 			
					if(length>0){ 
						//弹出发送等待页面 1/发送总数 			
						for(var i=0;i<length;i++){					
							var resumeid = chk_value[i];
							var uid=$("#comuid"+resumeid).attr("date"); 
							//调用发送函数
							send_recom_email(uid,'{yun:}$smarty.get.id{/yun}',resumeid,length);  
							//继续执行
						}
						//弹出发送成功 
						setTimeout(function () {layer.closeAll();parent.layer.msg("发送完成！", 2,9,function(){location.reload();});return false;}, 1000); 
					}
					
				});
			} 
		} 
		function send_recom_email(comid,jobid,eid,uid,type){//type=0单条发送，其他数组为批量发送总数量	
			loadlayer();
			$.ajax({
				async: false, 
				url: 'index.php?m=admin_company&c=directrecom&id='+jobid+'&comid='+comid+'&eid='+eid +'&uid='+uid +'&'+ new Date().getTime(),
				type: 'GET',
				dataType: "json",
				timeout: 6000, 
				success: function(json){ 
					parent.layer.closeAll('loading');
					//发送成功，修改页面发送数量 
					if(type=='0'){
						parent.layer.msg(json.msg, 2, Number(json.type),function(){location.reload();});return false;
					}else if(type>0&&Number(json.type)=='9'){ 
						var send_num=$("#send_num").html();
						$("#send_num").html(parseInt(send_num)+parseInt(1));return true;
					} 
				}
			});
		}
	</script> 
	
	<title>后台管理</title>
	
</head>

<body class="body_ifm"> 
	<div class="infoboxp">
	
		<div class="admin_new_tip">
			<a href="javascript:;" class="admin_new_tip_close"></a>
			<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>
			<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>
			
			<div class="admin_new_tip_list_cont">
				<div class="admin_new_tip_list">为职位自动匹配简历</div>
			</div>
		</div>
		
		<div class="admin_new_search_box">
			<a href="javascript:history.back();" class="admin_new_cz_tj" style="margin-left:0px;">返回列表</a>
		</div>
		
  		<div class="clear"></div>
  		
  		<div class="table-list">
 			<div class="admin_table_border"> 
      			<form action="index.php?m=reward&c=del" name="myform" method="post"  target="supportiframe" id='myform'>
				    <input type="hidden" name="pytoken" id='pytoken' value="{yun:}$pytoken{/yun}">
				    <input type="hidden" name="comid"  value="{yun:}$comid{/yun}">
				 	<table width="100%">
				    	<thead>
				       		<tr class="admin_table_top">
				          		<th><label for="chkall"><input type="checkbox" id='chkAll'  onclick='CheckAll(this.form)'/></label></th>
				            	<th>简历编号</th> 
				            	<th align="left">姓名</th>
					            <th align="left" width="50%">期望职位</th>
					            <th align="left">工作地区</th>
								<th class="admin_table_th_bg">操作</th>
							</tr>
				        </thead>
				        
				        <tbody>
					        {yun:}foreach item=v key=key from=$resumes{/yun}
						        
						        <tr align="center">
						          	<td><input type="checkbox" date="{yun:}$comid{/yun}" id='comuid{yun:}$v.id{/yun}' value="{yun:}$v.id{/yun}" class="check_all"  name='del[]' onclick='unselectall()' rel="del_chk" /></td>
						          	<td class="td1" style="text-align:center;"><span>{yun:}$v.id{/yun}</span></td> 
						          	<td class="ud" align="left"><a href="{yun:}url m=resume c=show id='`$v.id`' look=admin{/yun}" target="_blank" class="admin_cz_sc">{yun:}$v.uname{/yun}</a></td>
						          	<td class="ud" align="left">{yun:}$v.job_classname{/yun}</td>
						          	<td class="ud" align="left">{yun:}$v.city_classname{/yun}</td>
						          	<td>
						          <a href="javascript:void(0);" class="status admin_cz_sh"  onclick="send_recom_email('{yun:}$comid{/yun}','{yun:}$smarty.get.id{/yun}','{yun:}$v.id{/yun}','{yun:}$v.uid{/yun}','0')">推送</a></td>
						        </tr>
						        
					        {yun:}foreachelse{/yun}
					        
								<tr align="center"><td colspan="8">暂无合适简历</td></tr>
					        
					        {yun:}/foreach{/yun}
				        
				        	<tr>
								<td align="center"><label for="chkall2"><input type="checkbox" id='chkAll2' onclick='CheckAll2(this.form)' /></label></td>
				          		<td colspan="8" > 
						 			<label for="chkAll2">全选</label>
				            		<input class="admin_button" type="button" name="delsub" value="批量推荐" onClick="directs('del[]');" />&nbsp;&nbsp;
				            	</td>
				         	</tr>
				         	
						 	{yun:}if $total > $config.sy_listnum {/yun}
								<tr>
									{yun:}if $pagenum==1{/yun}
										<td colspan="3"> 从 1 到 {yun:}$config.sy_listnum {/yun} ，总共 {yun:}$total{/yun} 条</td>
									{yun:}else if $pagenum > 1 && $pagenum < $pages{/yun}
										<td colspan="3"> 从 {yun:}($pagenum-1) * $config.sy_listnum + 1{/yun} 到 {yun:}$pagenum * $config.sy_listnum{/yun} ，总共 {yun:}$total{/yun} 条</td>
									{yun:}else if $pagenum == $pages{/yun}
										<td colspan="3"> 从 {yun:}($pagenum-1) * $config.sy_listnum + 1{/yun} 到 {yun:}$total{/yun} ，总共 {yun:}$total{/yun} 条</td>
									{yun:}/if{/yun}
									<td colspan="6" class="digg">{yun:}$pagenav{/yun}</td>
								</tr>
							{yun:}/if{/yun}
				     	</tbody>
					</table> 
				</form>
	  		</div>
		</div> 
	</div> 
</body>
</html>